/*
	Author: Richard McKenna
			Stony Brook University
			Computer Science Department

	WRButtonEventHandler.cpp

	See WRButtonEventHandler.h for a class
	description.
*/

#include "stdafx.h"
#include "Game.h"
#include "WRButtonEventHandler.h"

void WRButtonEventHandler::handleButtonEvents(Game *game, 
											  wchar_t *command)
{
	// SOMEONE PRESSED THE Exit BUTTON, SO CHANGE THE
	// Game State TO END THE APPLICATION
	if (wcscmp(command, L"ExitGame") == 0)
	{
		if(MessageBox(NULL, 
			(LPCWSTR)L"Are you sure you want to exit?",
			(LPCWSTR)L"Confirm Exit", 
			MB_ICONQUESTION | MB_YESNO) == IDYES)			
				game->changeGameState(EXIT_GAME_STATE);
	}
	else if (wcscmp(command, L"ExitLevel") == 0)
	{
		game->changeGameState(SPLASH_SCREEN_GAME_STATE);
	}	
	else if (wcscmp(command, L"Start") == 0)
	{
		game->changeGameState(GAME_PLAYING_GAME_STATE);		
	}	
	else if (wcscmp(command, L"GameControls") == 0)
	{
		game->changeGameState(GAME_CONTROLS_STATE);
	}	
	else if (wcscmp(command, L"AboutCreator") == 0)
	{
		game->changeGameState(ABOUT_CREATOR_STATE);
	}	
	else if (wcscmp(command, L"GoBack") == 0)
	{
		game->changeGameState(SPLASH_SCREEN_GAME_STATE);
	}
	else if (wcscmp(command, L"TryAgain") == 0)
	{
		game->changeGameState(GAME_PLAYING_GAME_STATE);
	}
	else if (wcscmp(command, L"PlayAgain") == 0)
	{
		game->changeGameState(GAME_PLAYING_GAME_STATE);
	}
	else if (wcscmp(command, L"GameOver") == 0)
	{
		game->changeGameState(GAME_OVER_STATE);
	}
	else if (wcscmp(command, L"YouWin") == 0)
	{
		game->changeGameState(YOU_WIN_STATE);
	}
	else if (wcscmp(command, L"ResumeGame") == 0)
	{
		//game->changeGameState(game->getPreviousGameState());
		game->changeGameState(GAME_PLAYING_GAME_STATE);
	}
}